package cn.zjutleo.village_server.mapper;

import cn.zjutleo.village_server.entity.EchartsData.OrderDataOption;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: 张坤
 * @DateTime: 2021/9/9 15:54
 * @Description: 该类用于 TODO
 */
public interface EchartsDataMapper {
    /**
    * @Author: 张坤
    * @Description: 这段用于查询  报修  的类型与数量,默认按照ra_type进行排序
    */
    @Select("select  ra_type,count(ra_type) as count\n" +
            "            from repair_apply\n" +
            "            where ra_detail_address like '%${addressName}%'\n" +
            "            group by ra_type")
    @Results(id = "Base_RepairApplyData",value = {
        @Result(property = "typeName" ,column = "ra_type"),
        @Result(property = "count" , column = "count")
    })
    List<OrderDataOption> selectRepairApplyData(String addressName);

    /**
     * @Author: 张坤
     * @Description: 这段用于查询  派单  的类型与数量,默认按照ra_type进行排序
     */
    @Select("select  ra_type,count(ra_type) as count\n" +
            "            from viewdispatchrepairinfo\n" +
            "            where ra_detail_address like '%${addressName}%'\n" +
            "            group by ra_type")
    @ResultMap("Base_RepairApplyData")
    List<OrderDataOption> selectDispatchRepairyData(String addressName);
}
